package it.unibo.imola.parser.visitor.entity;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

public abstract class Instruction implements Executable,Checkable{

	/* (non-Javadoc)
	 * @see it.unibo.imola.parser.evaluation.entity.Checkable#check(it.unibo.imola.parser.evaluation.entity.Environment)
	 */
	@Override
	public boolean check(Environment env) throws Exception {
		if(env==null)
			throw new Exception("env==null");
		return true;
	}

	/* (non-Javadoc)
	 * @see it.unibo.imola.parser.evaluation.entity.Executable#exec(it.unibo.imola.parser.evaluation.entity.Environment)
	 */
	@Override
	public void exec(Environment env) throws Exception {
		if(env==null)
			throw new Exception("env==null");		
	}


	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this);
	}
	
}
